// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database();
const ChinaCollection = db.collection('China');
// 云函数入口函数 只要被 callFunction调用就会被执行
exports.main = async (event, context) => {
  // 内置 OPENID
  const wxContext = cloud.getWXContext();
  const result = await ChinaCollection
    .add({
      data:[
        {
          city:'南昌'
        },{
          city:'宜春'
        },{
          city:'九江'
        },{
          city:'赣州'
        }
      ]
    })
    const {data} = await ChinaCollection.get();
  return {
    event,
    China:data,
    openid: wxContext.OPENID,
  }
}